#pragma once
//------------------------------------------------------------------------------

#include "OgreExThread.h"
#include "OgreExSafeQueue.h"
#include <queue>
//------------------------------------------------------------------------------
namespace OgreEx
{
	class IMessage;
	class MessageHandlerBase;
class HandlerThreadBase : public Thread
{
public:
    /// constructor
	HandlerThreadBase() : mMsgQueue(NULL),mHandlerQueue(NULL) {}
	virtual ~HandlerThreadBase() {}

public:
	void doWork(void* const context);
	void setWorkQueue(SafeQueue<IMessage*>* msgqueue)
	{ 
		mMsgQueue = msgqueue; 
	}
	void setHandlerQueue(queue<MessageHandlerBase*>* handlerqueue) 
	{ 
		mHandlerQueue = handlerqueue; 
	}
protected:
	virtual bool handleMessage(IMessage* msg);
 
protected:
	SafeQueue<IMessage*>* mMsgQueue;
	std::queue<MessageHandlerBase*>* mHandlerQueue;
};

} // namespace Messaging
//------------------------------------------------------------------------------
